﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using System.IO;

namespace EntGuayasSLA.BL
{
    public static class Util
    {
        public static void RegistarLog(object error, string ruta)
        {
            try
            {
                
                error = string.Format("{0}{0}--------{2} : {3}--------{0}{1}{0}",Environment.NewLine,error,DateTime.Now.ToLongDateString(),DateTime.Now.ToLongTimeString());
                System.Text.Encoding encod = System.Text.Encoding.UTF8;
                System.IO.FileStream log = System.IO.File.Open(ruta, System.IO.FileMode.Append);
                log.Write(encod.GetBytes(error.ToString()), 0, encod.GetByteCount(error.ToString()));
                log.Close();
            }
            catch (Exception ex)
            {
                try
                {
                    //var log = Log.NewLog();
                    //log.InfoLog =
                    //    string.Format("Error de Log de la aplicación{0}{1}Información de controlador del Log {2}", error, Environment.NewLine, ex.ToString());
                    //log.Save();
                }
                catch
                {
                }
            }
        }
    }
}
